package com.tc.juc.n1;

import lombok.extern.slf4j.Slf4j;

/**
 * @Auther: tianchao
 * @Date: 2021/9/27 21:25
 * @Description:
 */
@Slf4j
public class Test16 {
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            log.info("洗水壶");
            sleep(1);
            log.info("烧水");
            sleep(5);
        },"老汪");
        Thread t2 = new Thread(()->{
            log.info("洗茶壶");
            sleep(1);
            log.info("洗茶杯");
            sleep(10);
            log.info("拿茶叶");
            sleep(1);
            try {
                log.info("t1状态{}",t1.getState());
                t1.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.info("泡茶");
        },"小刘");
        t1.start();
        t2.start();

    }


    public static void  sleep(int seconds){
        try {
            Thread.sleep(seconds*1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
